package com.itheima.blockingquene;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Demo01 {

    public static void main(String[] args) throws InterruptedException {
        /*
        ArrayBlockingQueue
        LinkedBlockingQueue
        */
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<>(3);

        queue.put("蔡徐坤1");
        queue.put("蔡徐坤2");
        queue.put("蔡徐坤3");
        System.out.println(queue.take());
        queue.put("蔡徐坤4");
        LinkedBlockingQueue<String> queue2 = new LinkedBlockingQueue<>();
        for (int i = 0; i < 100; i++) {
            queue2.put("蔡徐坤"+i);
        }
        System.out.println(queue2);
    }
}
